﻿using System;
using System.Windows.Forms;

namespace GrindZonesRandomizer
{
    public partial class ConfigForm : Form
    {
        public ConfigForm()
        {
            InitializeComponent();
            opf_LoadZones.Filter = "XML Files|*.xml";
            sfd_SaveZones.Filter = "XML Files|*.xml";
        }

        #region Load/Close

        private void ConfigFormLoad(object sender, EventArgs e)
        {
            cb_RandomizeZones.Checked = GrindZonesRandomizer.MySettings.RandomizeZones;
            txt_defaultSettingsPath.Text = GrindZonesRandomizer.MySettings.DefaultSettingsPath;
        }

        private void ConfigFormClose(object sender, EventArgs e)
        {
            GrindZonesRandomizer.MySettings.SaveSettings();
        }

        #endregion

        #region ZoneControl

        private void BtLoadZonesClick(object sender, EventArgs e)
        {
            if (opf_LoadZones.ShowDialog() != DialogResult.OK) return;

            Helpers.MyZones.LoadZones(opf_LoadZones.FileName);

            GrindZonesRandomizer.MySettings.LastZoneFilePath = opf_LoadZones.FileName;
        }

        private void CbRandomizeZonesCheckedChanged(object sender, EventArgs e)
        {
            GrindZonesRandomizer.MySettings.RandomizeZones = cb_RandomizeZones.Checked;
        }

        #endregion

        #region CreateRotation

        private void BtCreateZoneListClick(object sender, EventArgs e)
        {
            var createListForm = new CreateZoneList();
            createListForm.Show();
        }

        #endregion

    }
}
